package com.trp.model.psr;

import com.trp.model.CIMModel;

import java.util.HashMap;
import java.util.Map;



public class Circuit extends PSR {


	private Map<String, CircuitSection> mSections;


	@Override
	protected void init() {
		mSections = new HashMap<String, CircuitSection>(0);
		this.mType = CIMModel.Type.CIRCUIT;
	}



	public void addCircuitSection(CircuitSection cs) {
		if (cs == null || cs.getID() == null || cs.getID().isEmpty()) {
			throw new NullPointerException(" can not add null circuit section to circuit!");
		}
		mSections.put(cs.getID(), cs);
	}


	public void removeCircutSection(CircuitSection cs) {
		if (cs == null || cs.getID() == null || cs.getID().isEmpty()) {
			throw new NullPointerException(" can not add null circuit section to circuit!");
		}
		mSections.remove(cs);
	}

	public boolean exists(CircuitSection cs) {
		if (cs == null) {
			throw new NullPointerException(" can not check null circuit section in circuit!");
		}
		return mSections.containsValue(cs);
	}



}
